import {request, config} from 'utils'
import axios from 'axios'
import FileSaver from 'file-saver'

const {api} = config
const {shop} = api

//购物车数据
export async function query({distributorId}) {
  const url = `${shop}/cart/list/${distributorId}`
  return request({url: url, method: 'get', data: {}})
}

// 更新购物车
export async function updateCart(queryParam) {
  const url = `${shop}/cart/updatenumber`
  return request({url: url, method: 'put', data: queryParam})
}

// 删除购物车商品
export async function deleteCart(queryParam) {
  const url = `${shop}/cart/delete`
  return request({url: url, method: 'post', data: queryParam})
}

//去结算
export async function cartCaluate({items}) {
  const url = `${shop}/cartlist`
  return request({url: url, method: 'post', data: {}})
}
